package org.android.tools;

import java.util.Hashtable;

import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.KvmSerializable;

public class ShoppingList implements KvmSerializable {
	public Integer idshoppingList;
	public int idUser;
	public String value;

	public ShoppingList() {

	}
	public ShoppingList(int idUser) {
		this.idUser = idUser;
	}
	public ShoppingList(int idUser, String value) {
		this.idUser = idUser;
		this.value = value;
	}
	
	public Object getProperty(int arg0) {
		// TODO Auto-generated method stub
		switch(arg0) {
		case 0:
			return idUser;
		case 1:
			return idshoppingList;
		case 2:
			return value;
		}
		return null;
	}

	public int getPropertyCount() {
		// TODO Auto-generated method stub
		return 3;
	}

	public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo arg2) {
		// TODO Auto-generated method stub
		switch(arg0)
		{
		case 0:
			arg2.type = PropertyInfo.INTEGER_CLASS;
			arg2.name = "idUser";
			break;
		case 1:
			arg2.type = PropertyInfo.INTEGER_CLASS;
			arg2.name = "idshoppingList";
			break;
		case 2:
			arg2.type = PropertyInfo.STRING_CLASS;
			arg2.name = "value";
			break;
		default:break;
		}
	}

	public void setProperty(int arg0, Object arg1) {
		// TODO Auto-generated method stub
		switch(arg0)
		{
		case 0:
			idUser = Integer.parseInt(arg1.toString());
			break;
		case 1:
			idshoppingList = Integer.parseInt(arg1.toString());
			break;
		case 2:
			value = arg1.toString();
			break;
		default:
			break;
		}
	}

	public static ShoppingList parseShoppingList(SoapObject soap, int arg0)
	{
		SoapObject arg1 = (SoapObject) soap.getProperty(arg0);
		ShoppingList shoppingList = new ShoppingList();
		shoppingList.idUser = Integer.parseInt(arg1.getProperty(0).toString());
		shoppingList.idshoppingList = Integer.parseInt(arg1.getProperty(1).toString());
		shoppingList.value = arg1.getProperty(2).toString();
		return shoppingList;
	}

}
